package validation;

import net.sf.oval.configuration.annotation.AbstractAnnotationCheck;
import net.sf.oval.context.OValContext;
import net.sf.oval.exception.OValException;
import net.sf.oval.Validator;

public class Numbercheck extends AbstractAnnotationCheck<Number> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public boolean isSatisfied(
								Object validatedObject, 
								Object value, 
								OValContext context, 
								Validator validator)
		throws OValException
	{
		int j=0;
		boolean test=true;
		if (value == null) 
			return true;

		String val = value.toString();
		


		for( int i=0;i<val.length();i++)
		{
			if((val.charAt(i)=='0')||(val.charAt(i)=='1')||(val.charAt(i)=='2')||(val.charAt(i)=='3')||(val.charAt(i)=='4')||
					(val.charAt(i)=='5')||(val.charAt(i)=='6')||(val.charAt(i)=='7')||(val.charAt(i)=='8')||(val.charAt(i)=='9'))
			{ 
				j++;
				}
			
			
			
	}
		if(j!=val.length())
		{
			test=false;
	}
		return test;
	}
}
